home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 98
/
Skunkware 98.iso
/
src
/
fileutil
/
tar-1.12.tar.gz
/
tar-1.12.tar
/
tar-1.12
/
scripts
/
weekly.new
< prev
Wrap
Text File
|
1990-11-01
|
1KB
|
43 lines
#!/bin/sh
# start doing things
TOBACKUP="albert:/"
HOST=`hostname | sed 's/\..*//'`
TAPEFILE=/dev/rfd0a
LOGFILE=tar-out
BLOCKING=20
TAR_PART1="/usr/local/bin/tar clbfVM $BLOCKING"
rm -f $LOGFILE
mt -f $TAPEFILE rewind
host=`echo $TOBACKUP | sed 's/:.*$//'`;
fs=`echo $TOBACKUP | sed 's/^.*://'`;
date=`date`;
fsname=`echo $TOBACKUP | sed 's/\//:/g'`
TAR_PART2="'Weekly backup of $fs on $host at $date' -C $fs ."
echo Backing up $TOBACKUP at $date | tee -a $LOGFILE
# Actually back things up.
if [ $HOST != $host ] ; then
rsh $host $TAR_PART1 $HOST:$TAPEFILE $TAR_PART2
else
sh -c "exec $TAR_PART1 $TAPEFILE $TAR_PART2"
fi
if [ $? -ne 0 ] ; then
echo Backup of $TOBACKUP failed. | tee -a $LOGFILE
echo mts at time of failure | tee -a $LOGFILE
mts -t $TAPEFILE | tee -a $LOGFILE
# I'm assuming that the tar will have written an empty
# file to the tape, otherwise I should do a cat here.
else
echo $date > $fsname.lasttar
fi
sleep 60;
mt -f $TAPEFILE rewind
mt -f $TAPEFILE offl